package com.hiwhitley.easy.day08;

/**
 * Created by hiwhitley on 2016/8/12.
 */
public class MoveZeroes {
    public static void moveZeroes(int[] nums) {
        int zeros = 0;
        for(int i=0; i<nums.length; i++) {
            int val = nums[i];
            if(val == 0) {
                zeros++;
            } else {
                nums[i] = 0;
                nums[i - zeros] = val;
            }
        }
    }

    public static void main(String[] args) {
        moveZeroes(new int[]{0, 1, 0, 3, 12});
    }
}
